#include <glib/gi18n.h>
+static gboolean opt_modern;
+
static GOptionEntry options[] = {
+ { "modern", 0, 0, G_OPTION_ARG_NONE, &opt_modern, "Only create /boot and /ostree", NULL },
{ NULL }
};
if (!glnx_opendirat (AT_FDCWD, sysroot_path, TRUE, &root_dfd, error))
return FALSE;
- const char *normal_toplevels[] = {"boot", "dev", "home", "proc", "run", "sys"};
- for (guint i = 0; i < G_N_ELEMENTS (normal_toplevels); i++)
- {
- if (!glnx_shutil_mkdir_p_at (root_dfd, normal_toplevels[i], 0755,
- cancellable, error))
- return FALSE;
- }
-
- if (!glnx_shutil_mkdir_p_at (root_dfd, "root", 0700,
- cancellable, error))
+ /* It's common to want to mount this outside of a deployment as well */
+ if (!glnx_shutil_mkdir_p_at (root_dfd, "boot", 0755, cancellable, error))
return FALSE;
- if (!glnx_shutil_mkdir_p_at (root_dfd, "tmp", 01777,
- cancellable, error))
- return FALSE;
- if (fchmodat (root_dfd, "tmp", 01777, 0) == -1)
+ /* See https://github.com/coreos/coreos-assembler/pull/688
+ * For Fedora CoreOS at least, we have this now to the point where we don't
+ * need this stuff in the physical sysroot. I'm not sure we ever really did,
+ * but to be conservative, make it opt-in to the new model of just boot/ and ostree/.
+ */
+ if (!opt_modern)
{
- glnx_set_prefix_error_from_errno (error, "chmod: %s", "tmp");
- return FALSE;
+ const char *traditional_toplevels[] = {"boot", "dev", "home", "proc", "run", "sys"};
+ for (guint i = 0; i < G_N_ELEMENTS (traditional_toplevels); i++)
+ {
+ if (!glnx_shutil_mkdir_p_at (root_dfd, traditional_toplevels[i], 0755,
+ cancellable, error))
+ return FALSE;
+ }
+
+ if (!glnx_shutil_mkdir_p_at (root_dfd, "root", 0700,
+ cancellable, error))
+ return FALSE;
+
+ if (!glnx_shutil_mkdir_p_at (root_dfd, "tmp", 01777,
+ cancellable, error))
+ return FALSE;
+ if (fchmodat (root_dfd, "tmp", 01777, 0) == -1)
+ {
+ glnx_set_prefix_error_from_errno (error, "chmod: %s", "tmp");
+ return FALSE;
+ }
}
+
g_autoptr(GFile) dir = g_file_new_for_path (sysroot_path);
g_autoptr(OstreeSysroot) sysroot = ostree_sysroot_new (dir);
if (!ostree_sysroot_ensure_initialized (sysroot, cancellable, error))
set -euo pipefail
-echo "1..$((26 + ${extra_admin_tests:-0}))"
+echo "1..$((27 + ${extra_admin_tests:-0}))"
+
+mkdir sysrootmin
+${CMD_PREFIX} ostree admin init-fs --modern sysrootmin
+assert_has_dir sysrootmin/boot
+assert_has_dir sysrootmin/ostree/repo
+assert_not_has_dir sysrootmin/home
+rm sysrootmin -rf
+echo "ok init-fs --modern"
function validate_bootloader() {
cd ${test_tmpdir};
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
export rev
-# This initial deployment gets kicked off with some kernel arguments
+# This initial deployment gets kicked off with some kernel arguments
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
new_mtime=$(stat -c '%.Y' sysroot/ostree/deploy)
assert_not_streq "${orig_mtime}" "${new_mtime}"